package com.tools.cleanmaster.bean;

import com.tools.cleanmaster.utils.MimeTypeUtil;

/**
 * Created by liyunfeng on 15/12/1.
 * 专清 针对深度路径需要细化处理的 文件类型
 */
public class FileType {
    public static final int TYPE_MP3 = 1;
    public static final int TYPE_VIDEO = 1 << 1;//2
    public static final int TYPE_PIC = 1 << 2;  //4

    public static final int TYPE_SCAN_ONLY_CARE_SONFILE = 1 << 10;
    public static final int TYPE_SCAN_DEAL_NO_EXTENSION = 1 << 11;

    public static int getFileTypeBits() {
        return TYPE_MP3 | TYPE_VIDEO | TYPE_PIC;
    }

    public static final int[] getFileTypeArray() {
        return new int[]{TYPE_MP3, TYPE_VIDEO, TYPE_PIC};
    }

    public static int getFileType(String fileName) {
        String mimeType = MimeTypeUtil.getMimeType(fileName);
        if (mimeType.startsWith("ani/images")) {
            return FileType.TYPE_PIC;
        } else if (mimeType.startsWith("video")) {
            return FileType.TYPE_VIDEO;
        } else if (mimeType.startsWith("audio")) {
            return FileType.TYPE_MP3;
        }
        return 0;
    }
}
